import React from 'react';
import {
    StyleSheet,
    View,
    Button,
    Text,
    Image
} from 'react-native';
import { createBottomTabNavigator, createAppContainer } from 'react-navigation';

class HomeScreen extends React.Component {
  render() {
    return (
      <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
        <Text>Home!</Text>
      </View>
    );
  }
}

class SettingsScreen extends React.Component {

  render() {
        return (
            <View >
                <Button
                    title={'打开侧栏'}
                    onPress={() => {
                        this.props.navigation.openDrawer();
                    }}
                />
                <Text>从Tab打开侧栏</Text>
            </View>
        );
  }
}

const TabNavigator = createBottomTabNavigator({
  Home: HomeScreen,
  Settings: SettingsScreen,
});

const Tab= createAppContainer(TabNavigator);
export default Tab